home *** CD-ROM | disk | FTP | other *** search
- Path: opengovt.open.org!john
- From: THayworth@open.org (Tina Hayworth)
- Newsgroups: comp.lang.c++
- Subject: HELP - Passing strings to a DLL
- Date: 8 Apr 1996 15:31:46 GMT
- Organization: OPEN.ORG
- Message-ID: <4kbbh2$r3c@hp_open.open.org>
- NNTP-Posting-Host: 199.2.103.4
- Mime-Version: 1.0
- Content-Type: Text/Plain; charset=US-ASCII
- X-Newsreader: WinVN 0.99.7
-
-
- I am not an experienced C++ programmer, but I have taken a couple C
- classes a few years ago. I need to write a simple DLL that will be called by
- VB.
-
- I found some sample code, wrote the program, and it worked - I thought I had
- it all figured out. But if I try passing a pointer to a large string to a
- function in the DLL, I get a GPF.
-
- In the code below, if commarea is 40 bytes or less it works. If it is larger
- I get a GPF. The actual string I need to pass is 11,452 bytes.
-
- Can anyone tell me what I am doing wrong?
-
- Here is the function I am calling:
-
- int FAR PASCAL EciSync (char server[], char userid[], char passwd[],
- char program[], char transid[], char *commarea, int
- comsize)
- ---------------------------------------------------------------------------
- Here is my DEF file:
-
- LIBRARY ECIDLLL
-
- EXETYPE WINDOWS
-
- SEGMENTS
- WEPSEG PRELOAD FIXED
-
- CODE PRELOAD MOVEABLE DISCARDABLE
- DATA PRELOAD MOVEABLE SINGLE
-
- HEAPSIZE 5120
-
- EXPORTS
- WEP @1 RESIDENTNAME
- EciSync @2
- ------------------------------------------------------------------------
- Here is the Declaration in VB:
-
- Declare Sub EciSync Lib "ecidll.dll" (ByVal S As String, ByVal U As String,
- ByVal P As String, ByVal Pg As String, ByVal T As String, ByVal c As String,
- ByVal S As Integer)
-
-
-